//
//  LiveNewsCell.m
//  ios_news
//
//  Created by Han on 14-7-7.
//  Copyright (c) 2014年 ucoder. All rights reserved.
//

#import "LiveNewsCell.h"

@implementation LiveNewsCell
@synthesize newsImg = _newsImg, timeLabel = _timeLabel, textLabel = _textLabel, line = _line;


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        _newsImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"common"]];
        [_newsImg setFrame:CGRectMake(10, 15, 19, 19)];
        [self addSubview:_newsImg];
        
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(GET_LEFT_X(_newsImg)+5, 14, 200, 19)];
        _timeLabel.backgroundColor = [UIColor clearColor];
        _timeLabel.textColor = ColorWithRGB(96, 96, 96);
        _timeLabel.font = [UIFont systemFontOfSize:13.f];
        //_timeLabel.text = @"2014-07-04 23:33";
        [self.contentView addSubview:_timeLabel];
        
        
        _textLabel = [[UILabel alloc] initWithFrame:
                        CGRectMake(GET_LEFT_X(_newsImg)+5,  34, 280, 60)];
        _textLabel.backgroundColor = [UIColor clearColor];
        _textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        [_textLabel setNumberOfLines:5];
        _textLabel.font = [UIFont systemFontOfSize:16.0];
        [self.contentView addSubview:_textLabel];
        
        _line = [[UIView alloc]initWithFrame:CGRectMake(10, 100-0.5, 320, 0.5)];
        [self.contentView addSubview:_line];
        
        _line.backgroundColor = [UIColor lightGrayColor];

    }
    return self;
}

- (void)setLiveNews:(LiveNews *)liveNews {
    //NSLog(@"%@", liveNews.content);
    _textLabel.text = [Util formatHtmlString:liveNews.content];
    _timeLabel.text = [Util getDateFromTimestamp:liveNews.time];
    
}



@end
